package com.woniu.service.Impl.homePage;

import com.woniu.dao.homePage.GoodsLogDao;
import com.woniu.entity.Goods;
import com.woniu.entity.GoodsLog;
import com.woniu.service.homePage.IGoodsLogService;
import com.woniu.util.ResData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 浏览历史接口实现类
 * @author 李松桦
 * @data 2023/3/14 12:02
 */
@Service
public class GoodsLogServiceImpl implements IGoodsLogService {
    @Autowired
    GoodsLogDao goodsLogDao;

    /*根据手机号查询商品浏览历史*/
    @Override
    public ResData<?> queryGoodsLog(String phone) {
        List<Goods> goodsLog = goodsLogDao.queryGoodsLog(phone);
        return new ResData<>().ok(goodsLog);
    }

    /*根据手机号,商品编号删除商品浏览历史*/
    @Override
    public ResData<?> deleteGoodsLog(GoodsLog goodsLog) {
        goodsLogDao.deleteGoodsLog(goodsLog);
        return new ResData<>().ok();
    }

}
